<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<%
String path = request.getContextPath();
%>
<%@ page contentType="text/html;charset=UTF-8" %>
<%@ taglib uri="http://jakarta.apache.org/struts/tags-bean" prefix="bean" %>
<%@ taglib uri="http://jakarta.apache.org/struts/tags-html" prefix="html" %>
<%@ taglib uri="http://jakarta.apache.org/struts/tags-logic" prefix="logic" %>
<html:html locale="true">
<head>
<meta http-equiv="pragma" content="no-cache">
<meta http-equiv="cache-control" content="no-cache">
<meta http-equiv="expires" content="0">
<title></title>
<link href="console.css" rel="stylesheet" type="text/css">
<style type="text/css">
<!--
.style1 {font-size: 16px}
-->
.even {
	background:	#eee;
}

.odd {

}
</style>
</head>

<body>
<jsp:include page="/title.jsp" flush="true"/>
	<p class="lnkhead2"><bean:message key="menu.componentLibrary"/>&gt;<bean:message key="menu.actionComponents"/>&gt;<bean:write name="datatype" property="type"/></p>
	<form name="form" method="post" action="action.do">
	<input type="hidden" name="act"/>
	<input type="hidden" name="oldimplClass" value='<bean:write name="datatype" property="implClass"/>'/>
	<input type="hidden" name="oldtype" value='<bean:write name="datatype" property="type"/>'/>
	<table width="723" border="0" cellpadding="0" cellspacing="0">
  <!--DWLayoutTable-->
  
  <tr class="txtnormal2">
    <td height="32"><div align="right"><bean:message key="heading.name"/>&nbsp;</div></td>
    <td ><html:text name="datatype" property="name"/></td>
  </tr>
  <tr class="txtnormal2">
    <td height="68"><div align="right"><bean:message key="heading.desc"/>&nbsp;</div></td>
    <td><html:textarea name="datatype" property="desc"  cols="48" rows="4"/></td>
  </tr>
  <tr class="txtnormal2">
    <td height="32"><div align="right"><bean:message key="heading.type"/>&nbsp;</div></td>
    <td>
    <html:select  name="datatype" property="type" >
   <html:options collection ="typetypelist" property="type" labelProperty="name"></html:options>
</html:select>
</td>
  </tr>
  <tr class="txtnormal2">
    <td height="29"><div align="right"><bean:message key="component.javaImplClass"/>&nbsp;</div></td>
    <td>
    <html:text name="datatype" property="implClass" size="48" />
      </td>
  </tr>
  
  </table>
  <table width="50%">		
			<tr >
				
				<td align="right">
					<input  type="button" name="Submit" value="<bean:message key="button.save"/>" onclick="javascript:updateDataType()"/>
				
				</td>
			</tr>
</table>
  <script type="text/javascript">

	function updateDataType(){
 		var frm = document.forms["form"];
		frm.elements["act"].value="updateDataDetail";
		
		 if(!checkClassName(frm.elements["implClass"],"<bean:message key="component.javaImplClass"/>")) return;

		if(frm.elements["name"].value==""){
			alert("<bean:message key="component.needName"/>");
			frm.elements["name"].focus();
			return;
		}
		if(frm.elements["type"].value==""){
			alert("<bean:message key="component.needType"/>");
			frm.elements["type"].focus();
			return;
		}
		
		frm.submit();
	};
	
	
	
</script>
 
  <table width="100%">
  <tr  class="txtnormal2">
    <td height="32" valign="bottom"><div align="left"><bean:message key="component.attrAndMethodList"/></div></td>
  </tr>
</table>
	  
	  <table width="100%" border="0" cellpadding="1" class="sort-table" id="table-1" cellspacing="0">
	
	<thead>
			
			<tr >
				<td align="center" width="4%" >&nbsp;</td>
				
				
				<td align="center" width="18%">
					
					<bean:message key="heading.name"/>
					
				</td>
				
				
				<td align="center" width="10%">
					
					<bean:message key="heading.type"/>
					
				</td>
				
				<td align="center" width="36%">
					
					<bean:message key="heading.desc"/>
					
				</td>
				
				
			  <td align="center" width="20%">
					
					<bean:message key="component.sample"/>
					
				</td>
				
				<td align="center" width="12%">
					
					<bean:message key="component.initValue"/>
					
				</td>

				
			</tr>
	  </thead>
			<tbody>
			<% int i=0; String color;String check="";%>
			
			<logic:iterate id="attr" name="datatype" property="attributs">
				
				<% i++; if(i%2==1) color="odd"; else color="even"; if(i==1) check="checked"; else check="";%>
				
				<tr  class="<%=color%>">
					<td align="center">
					<input type="radio" <%=check%> name="attrName"  value="<bean:write name='attr' property='name'/>" />
								
					</td>
					
					
					<td align="left">
						<bean:write name='attr' property='name'/>
					</td>
					<td align="center">
						
						<bean:write name='attr' property='typeName'/>
					</td>
					
					<td align="left">
						<bean:write name='attr' property='desc' filter="false"/>
					</td>
					
					<td align="left">
						<bean:write name='attr' property='template'  filter="true"/>
					</td>
					
					<td align="center">
						<bean:write name='attr' property='intiValue'/>
					</td>
					
					
					
				</tr>
			
			</logic:iterate>
	  </tbody>
</table>
<table width="100%">		
			<tr >
				
				<td align="left">
					<input  type="submit" name="Submit" value="<bean:message key="button.add"/>" onclick="javascript:add()"/>
					<input  type="button" name="Submit1" value="<bean:message key="button.update"/>" onclick="javascript:update()"/>
					<input  type="button" name="Submit2" value="<bean:message key="button.delete"/>" onclick="javascript:del()"/>
				</td>
			</tr>
</table>
</form>
<script type="text/javascript">
function add()
	{
	var frm = document.forms["form"];
	frm.elements["act"].value="newAttr";
	frm.submit();
	}
	
	function update()
	{
	var frm = document.forms["form"];
	frm.elements["act"].value="queryAttrDetail";
	frm.submit();
	};
	
	function del()
	{
	var frm = document.forms["form"];
	var attrName=(selectedRadiobox(frm,"attrName"));
	if( !confirm("<bean:message key='button.confirmDelete'/>"+attrName)) return;
	frm.elements["act"].value="deleteAttr";
	frm.submit();
 };
 </script>
			<script type="text/javascript">
var st = new SortableTable(document.getElementById("table-1"),
	["None", "String","String",  "String", "String","String"]);
	
</script>
<logic:notEmpty name="returnMsg">
	<script>
	//parent.frames[0].location.reload();
	alert('<bean:write name="returnMsg"/>');
	</script>
	</logic:notEmpty>
<%@ include file="/table_bottom.jsp" %>
</body>
</html:html>



